<template>
	<div class="xj-gonggaowhiteback">
		<i class="iconfont gonggao-icon" style="color:blueviolet">&#xe678;</i>
		<marquee class="xj-search-input">
			<span v-if="gonggao[0].text?false:true">{{gonggao[0].text?'':'请输入公告内容'}}</span>
			<a :href="item.url" @click="myClick($event)" v-for="(item,index) in gonggao" :key="index" style="margin-right: 50px;">
				<span style="color:blueviolet">{{item.text}}
				</span>
			</a>
		</marquee> 
	</div>
</template>

    
<script>
	export default {
		props: ["gonggao","prevent"],
		methods:{
			myClick(e){
				//不阻止事件行为
				if(this.prevent){
				//阻止事件行为
				e.preventDefault();
                return;
			    }
			}
		},
		created(){
			//console.log(this.gonggao);
		}
	}
</script>

<style lang="scss">
	.xj-gonggaowhiteback {
		width: 100%;
		height: 35px;
		display: flex;
		align-items: center;
		justify-content: flex-end;
		position: relative;
		margin-top:5px;
		margin-top:5px;
		border-radius: 50px;
		background-color: #F4F6F7;
		.gonggao-icon {
			position: absolute;
			left: 4.5%;
			// z-index: 999;
			font-weight: 300;
		}
		.xj-search-input {
			background-color: #F4F6F7;
			width: 82%;
			line-height: 30px;
			font-size:12px;
			border: none;
			border-radius: 50px;
			padding-left: 30px;
		}
		
	}
</style>